<%@ page language="java" import="java.util.*,com.wit.service.impl.*,com.wit.po.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
DepartmentserviceImp deimp=new DepartmentserviceImp();
List<Department> dlist=deimp.DepartmentList();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>员工信息统计</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="<%=basePath%>/style/main.css" rel="stylesheet" type="text/css" />
    <link type="text/css" rel="stylesheet" href="<%=basePath%>/style/style.css" />
    <link href="<%=basePath%>/style/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
	<script src="<%=basePath%>/Scripts/jquery-1.3.1.js" type="text/javascript"></script>
	<script src="<%=basePath%>/Scripts/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
    <script src="<%=basePath%>/Scripts/jquery.validate.js" type="text/javascript"></script>
    <script src="<%=basePath%>/Scripts/ui.datepicker-zh_CN.js" type="text/javascript"></script>
    <script>
 function changeV(objID)
			{
				if(document.getElementById("tbody_"+objID).style.display == "block")
				{
					
					document.getElementById("img_"+objID).src = "<%=basePath%>/images/ico_have2.gif";
					document.getElementById("tbody_"+objID).style.display = "none"
				}
				else
				{
					document.getElementById("img_"+objID).src = "<%=basePath%>/images/ico_nohave2.gif";
					document.getElementById("tbody_"+objID).style.display = "block"
				}
			}
</script>
<script type="text/javascript">
		function datePicker(pickerName,locale) {
		$(pickerName).datepicker($.datepicker.regional[locale]);
		$(pickerName).datepicker('option', 'changeMonth', true);//月份可调
		$(pickerName).datepicker('option', 'changeYear', true);//年份可调
		
	}
	 $(function(){
	  datePicker('#FromDate','zh_CN');
	  datePicker('#ToDate','zh_CN');
  });
 function  QueryResult()
 {
 var sql="from Employee where 1=1";
 if($('#employeepositionId').val()!="")
 {
 sql+=" and employeeposition.positionName="+"'"+$('#employeepositionId').val()+"'";
 }
 if($('#departmentId').val()!="")
 {
   sql+=" and department.departmentId="+"'"+$('#departmentId').val()+"'";
 }
 if(($('#FromDate').val()!="") &&($('#ToDate').val()!=""))
 {
   var s1=$('#FromDate').val();
   var s2=$('#ToDate').val();
   sql+=" and enterDate between "+"'"+s1+"'"+" and "+"'"+s2+"'";
 }
 if($('#employeeEdu').val()!="")
 {
   sql+=" and employeeEdu="+"'"+$('#employeeEdu').val()+"'";
 }
 sql+=" and 2=2";
  var parameter = {
		sql : sql
	}; 
 $.ajax( {
		type : "post",
		dataType : "json",
		data : parameter,
		url : "QueryAction", 
		success:function(data){
		$("#contentB>tbody").text("");
		$.each(data,function(EmIndex,emp){
		var str = "<tr><td>"+"<a href=<%=basePath%>/Personnel/Personnel_StaffBasic.jsp?employeeId="+emp.employeeId+">"+emp.employeeId+"</a></td><td>"+emp.employeeNameC+"</td><td>"+emp.employeeIdcard+"</td><td>"+emp.positionName+"</td><td>"+emp.DepartmentName+"</td><td>"+emp.employeePh+"</td><td>"+emp.employeeTel+"</td><td>"+emp.employeeEdu+"</td><td>"+emp.enterDate+"</td><td>"+emp.employeeStatu+"</td><td>"+emp.employeeAddress+"</td></tr>";
	    $("#contentB>tbody").append(str);
		});
		}
		});
}
 function printdiv(printpage)
{
var headstr = "<html><head><title></title></head><body>";
var footstr = "</body>";
var newstr = document.all.item(printpage).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr+newstr+footstr;
window.print(); 
document.body.innerHTML = oldstr;
return false;
}
  </script>
  </head>
  
  <body>
  <table width="1200" cellpadding="0" cellspacing="0" class="table">
  <tr>
    <td>
      <table width="100%"  cellpadding="0" cellspacing="0" class="table2">
        <tr>
          <td valign="top">
            <table width="100%" class="top" cellpadding="0" cellspacing="0">
              <tr>
                <td>当前位置:&nbsp;人事管理&nbsp;&gt;&gt;&nbsp;员工统计</td>
              </tr>
            </table>
			<div id="mainareacontent">
        <div class="mainarea">
            <div class="search">			
			 
                <table width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td class="ico">
                            <a href="javascript:changeV(1)">
                                <img  src="<%=basePath%>/images/ico_have2.gif" id="img_1" border="0"></a>                        </td>
                      <td ><table cellpadding="0" cellspacing="0" width="100%" >
                        <tbody id="tbody_1" style="display: none; border: 0px;">
                          <tr>
                            <th height="19"> 员工职位：</th>
                            <td><select name="employeepositionId" id="employeepositionId" >
                                 <option value="">--请选择--</option>
								 <option>理财顾问</option>
								 <option>理财主任</option>
								 <option>行销经理</option>
								 <option>高级行销经理</option>
								 <option>理财经理</option>
								 <option>区域经理</option>
							</select></td>
							 <th>入司时间：</th>
                             <td><input type="text" id="FromDate" name="FromDate"/>
                                                                                        到
                                 <input type="text" id="ToDate" name="ToDate"/>                                                       
                             </td>
                            
                          </tr>
                          <tr>
                            <th> 部&nbsp;&nbsp;&nbsp;&nbsp;门： </th>
                            <td><select name="departmentId" id="departmentId">
                              <option value="">--请选择--</option>
				                  <%
				                    for(int i=0;i<dlist.size();i++)
				                    { 
				                    Department dep=dlist.get(i);  
				                  %>
				                    <option value="<%=dep.getDepartmentId() %>" ><%=dep.getDepartNameC()%></option>
				 
				                  <%
				                  }
				                  %>
                 			 </select></td>
                           
                            <th>学 &nbsp;&nbsp;&nbsp;历：</th>
                            <td> <select name="employeeEdu" id="employeeEdu" >
                                 <option value="">--请选择--</option>
                                  <option value="小学">小学</option>
								 <option value="本科">本科</option>
								 <option value="专科">专科</option>
								 <option value="高中">高中</option>
								 <option value="初中">初中</option>
								 <option value="硕士">硕士</option>
								 <option value="博士">博士</option>
								 <option value="博士后">博士后</option>
							</select>&nbsp;&nbsp;<img onClick="QueryResult()" src="<%=basePath%>/images/btn_search.gif" />&nbsp;&nbsp;<input type="button" style="width:40px; height:20px; font-size:12px; background-color: #E5F1FF" onClick="printdiv('dy');" value="打 印"  onClick="printdiv('dy');"/></td>
                          </tr>
                        </tbody>
                      </table></td>
                    </tr>
                </table>
            </div>
                    <table width="100%"  id="contentB" cellpadding="0" cellspacing="1" class="dg_borderstyle">
                      <thead>
                      <div id="dy">
                        <tr>
                          <th width="99">员工编号</th>
                          <th width="69">员工名称</th>
                          <th width="149">身份证号</th>
                          <th width="68">员工职位</th>
                          <th width="64">部门</th>
                          <th width="100">手机</th>
                          <th width="101">电话</th>
                          <th width="64">学历</th>
                          <th width="76">入司时间</th>
                          <th width="76">就职状态</th>
                          <th width="76">家庭住址</th>
                        </tr>
                      </thead>
                      <tbody >
                      
                      
                      </tbody>
                      </div>
                    </table>
                  
        </div>
      </div>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
  </body>
</html>
